package com.team.olympic.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.team.olympic.pojo.Item;

public interface ItemMapper {
    @Select("SELECT * FROM item")
    List<Item> findAllItems();
    @Select("SELECT * FROM item WHERE id = #{id}")
    Item findItemById(Long id);
    @Update("UPDATE item SET store = store - 1 WHERE id = #{id}")
    void declineStoreById(Long id);
    @Insert("INSERT INTO item_user(user_id, item_id) VALUES(#{userId}, #{itemId})")
    void insertItemUser(Long userId, Long itemId);
}
